]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[ShellApp] Add quit method
authorColin Walters <walters@verbum.org>
Wed, 24 Mar 2010 13:42:59 +0000 (09:42 -0400)
committerColin Walters <walters@verbum.org>
Tue, 11 May 2010 18:10:35 +0000 (14:10 -0400)
Closes the app, will be used for the panel app menu.  Note
this is just a very primitive implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=613804

src/shell-app.c
src/shell-app.h

index 6c78d23b130f4ec8028f0b1003665f9fffb4e71a..bf01a529298defcb5da1cc77035342c7922f6c35 100644 (file)
@@ -7,6 +7,8 @@
 #include "shell-global.h"
 #include "shell-enum-types.h"
 #include "display.h"
+#include "st.h"
+#include "shell-window-tracker.h"
 
 #include <string.h>
 
@@ -733,6 +735,37 @@ _shell_app_set_starting (ShellApp        *app,
     shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
 }
 
+/**
+ * shell_app_request_quit:
+ * @app: A #ShellApp
+ *
+ * Initiate an asynchronous request to quit this application.
+ * The application may interact with the user, and the user
+ * might cancel the quit request from the application UI.
+ *
+ * This operation may not be supported for all applications.
+ *
+ * Returns: %TRUE if a quit request is supported for this application
+ */
+gboolean
+shell_app_request_quit (ShellApp   *app)
+{
+  GSList *iter;
+
+  /* TODO - check for an XSMP connection; we could probably use that */
+
+  for (iter = app->windows; iter; iter = iter->next)
+    {
+      MetaWindow *win = iter->data;
+
+      if (!shell_window_tracker_is_window_interesting (win))
+        continue;
+
+      meta_window_delete (win, shell_global_get_current_time (shell_global_get ()));
+    }
+  return TRUE;
+}
+
 static void
 shell_app_init (ShellApp *self)
 {
index de969152fa9f486ede8545dbc209cb91f98bb2ec..22f612f1bd31adabe8d80966489ac577e2855842 100644 (file)
@@ -3,6 +3,7 @@
 #define __SHELL_APP_H__
 
 #include <clutter/clutter.h>
+#include <gio/gio.h>
 
 #include "window.h"
 
@@ -49,6 +50,8 @@ void shell_app_open_new_window (ShellApp *app);
 
 ShellAppState shell_app_get_state (ShellApp *app);
 
+gboolean shell_app_request_quit (ShellApp *app);
+
 guint shell_app_get_n_windows (ShellApp *app);
 
 GSList *shell_app_get_windows (ShellApp *app);